import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    index: localStorage.getItem('index') || 0,

    user: sessionStorage.getItem('v-user') ? JSON.parse(sessionStorage.getItem('v-user')) : {}
  },
  mutations: {
    setUser (state, user) {
      // 比如霸道总裁进来了 霸道总裁的数据都在user里面是这个意思
      state.user = user
      console.log(state.user)
    },
    shouyeManager(state, step) {
      state.index = step
      localStorage.setItem('index', step)

    },
    shopManager(state, step) {
      state.index = step
      localStorage.setItem('index', step)

    },
    userManager(state, step) {
      state.index = step
      localStorage.setItem('index', step)

    },
    staffManager(state, step) {
      state.index = step
      localStorage.setItem('index', step)
    }
  },
  actions: {},
  modules: {}
})